﻿<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>${pagetitle} - V${appsettings.version}</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/plugins/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/plugins/layuiadmin/style/admin.css" media="all">
  <link rel="stylesheet" href="/plugins/font-awesome/css/font-awesome.min.css">
  <style type="text/css">
      .top-bar__img {
          margin: 0 2px 3px 2px;
          padding: 2px;
          width: 30px;
          height: 30px;
          border-radius: 100%;
          -webkit-box-sizing: border-box;
          box-sizing: border-box;
          border: 1px solid #eee;
          vertical-align: middle;
      }
      .top-bar-title {
          font-size: 15px;
          font-weight: bold;
      }
  </style>
  <script>
  /^http(s*):\/\//.test(location.href) || alert('请先部署到服务器下再访问');
  </script>
</head>
<body class="layui-layout-body">
  <div id="LAY_app">
    <div class="layui-layout layui-layout-admin">
      <div class="layui-header">
        <!-- 头部区域 -->
        <ul class="layui-nav layui-layout-left">
          <li class="layui-nav-item layadmin-flexible" lay-unselect>
            <a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
              <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
            </a>
          </li>
        </ul>
        <ul class="layui-nav" style="padding:0 300px;" id="menu_top">
         <li class="layui-nav-item top-bar-title" lay-select>
            <a href="javascript:;">
              <i class="fa fa-gear"></i>
              系统管理
            </a>
          </li>
        </ul>
        <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
          <li class="layui-nav-item layui-hide-xs" lay-unselect>
            <a href="javascript:;" layadmin-event="refresh" title="刷新当前Tab">
              <i class="layui-icon layui-icon-refresh-3"></i>
            </a>
          </li>
          <li class="layui-nav-item layui-hide-xs" lay-unselect>
            <a href="/" target="_blank" title="前台首页">
              <i class="fa fa-home" style="font-size: 20px;padding-top:15px;"></i>
            </a>
          </li>
          <li class="layui-nav-item layui-hide-xs" lay-unselect>
            <a href="javascript:;" layadmin-event="fullscreen" title="全屏">
              <i class="layui-icon layui-icon-screen-full"></i>
            </a>
          </li>
          <li class="layui-nav-item" style="margin-right:15px;" lay-unselect>
            <a href="javascript:;">
              <img data-v-eaf42eba="" id="thumbnail" src="statics/logo/logo_top.png" class="top-bar__img">
              <cite id="username"></cite>
            </a>
            <dl class="layui-nav-child">
              <dd><a lay-href="../user/userprofile.html">基本资料</a></dd>
              <dd><a lay-href="../user/changepwd.html">修改密码</a></dd>
              <hr>
              <dd style="text-align: center;"><a href="logout.html">退出</a></dd>
            </dl>
          </li>
        </ul>
      </div>
      <!-- 侧边菜单 -->
      <div class="layui-side layui-side-menu">
        <div class="layui-side-scroll">
          <div class="layui-logo" lay-href="${appsettings.homeindex}">
           <img src="statics/logo/logo.png" style="width:32px;height:32px;margin-right:5px;" /><span style="font-weight:bold;">${pagetitle}</span>
          </div>
          <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="system-side-menu" lay-filter="layadmin-system-side-menu">
          </ul>
        </div>
      </div>
      <!-- 页面标签 -->
      <div class="layadmin-pagetabs" id="LAY_app_tabs">
        <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
        <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
        <div class="layui-icon layadmin-tabs-control layui-icon-down">
          <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
            <li class="layui-nav-item" lay-unselect>
              <a href="javascript:;"></a>
              <dl class="layui-nav-child layui-anim-fadein">
                <dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
                <dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
                <dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
              </dl>
            </li>
          </ul>
        </div>
        <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
          <ul class="layui-tab-title" id="LAY_app_tabsheader">
            <li lay-id="${appsettings.homeindex}" lay-attr="${appsettings.homeindex}" class="layui-this"><i class="layui-icon layui-icon-home"></i></li>
          </ul>
        </div>
      </div>
      <!-- 主体内容 -->
      <div class="layui-body" id="LAY_app_body">
        <div class="layadmin-tabsbody-item layui-show">
          <iframe src="${appsettings.homeindex}" frameborder="0" class="layadmin-iframe"></iframe>
        </div>
      </div>
      <!-- 辅助元素，一般用于移动设备下遮罩 -->
      <div class="layadmin-body-shade" layadmin-event="shade"></div>
    </div>
  </div>
  <script id="menu_item" type="text/html">
    {{#  layui.each(d, function(index, item){ }}
    <li class="layui-nav-item top-bar-title" data="{{item.id}}">
    <a href="javascript:;" style="align-content:center;">
        <i class="{{item.icon}}" style="font-size: 18px;"></i>
        {{item.title}}
    </a>
    </li>
    {{#  }); }}
   </script>
  <script src="/plugins/layui/layui.js"></script>
  <script type="text/javascript" src="/plugins/common/login.js" asp-append-version="true"></script>
  <script>
  layui.config({
    base: '/plugins/layuiadmin/' 
  }).extend({
    index: 'lib/index'
  }).use(['index','navbar','laytpl'], function () {
      var $ = layui.$, navbar = layui.navbar(),laytpl = layui.laytpl;
      layer.load();
      //检查服务器是否已登录，没有登录则跳转至登录页。
      $.ajax({
        type: "post",
        url: "/user/islogin",
        dataType: "json",
        success: function (res) {
            if (!res.islogin) {
                navbar.cleanCached();//清空菜单缓存
                ReLogin();
            }
            else {
                SaveSession(res.user);//存储本地会话
                $("#username").html(res.user.realname);
            }
        }
      });

      $.ajax({
            type: "get",
            url: "menu_get",
            dataType: "json",
            async:false,
            success: function (res) {
                if (res.code == 0) {
                    laytpl(menu_item.innerHTML).render(res.data, function(html){
                      menu_top.innerHTML = html;
                    });

                    if (res.data.length > 0) {
                        menu_render(res.data[0].id);
                    }

                    layer.closeAll('loading'); 
                }
                else {
                    layer.closeAll('loading'); 
                    layer.alert(res.msg);
                }
            }
      });

      function menu_render(parentid) {
          navbar.set({
            spreadOne: true,
            elem: '#system-side-menu',
            cached: false,
            url: 'menu_get?parentid=' + parentid
          });
          navbar.render();
      }

      $('#menu_top').on('click', 'li', function () {
          var data =  $(this).attr('data');
          menu_render(data);
      });
  });
  </script>
  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "//hm.baidu.com/hm.js?35483845f92e384129fb5d03f9d7c3cf";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
 </script>
</body>
</html>
